<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //ES6 允许按照一定模式从数组和对象中提取值，对变量进行赋值

        //1、数组的解构

        {
            const F4 = ['XM', 'XH', 'XF', 'XL'];
            let [name, age, size] = F4
            console.log(name)
            console.log(age)
            console.log(size)
        }

        //2、对象的解构

        {
            const P = {
                name: '王大',
                age: '15',
                eat: function () {
                    console.log('吃')
                }
            }
            let { name, age, eat } = P
            console.log(name)
            console.log(age)
            console.log(eat)
        }

        
    </script>
</body>

</html>